home *** CD-ROM | disk | FTP | other *** search
/ Cracking 1 / Cracking I..iso / Tools / Ostatní / aPLib v0.26b / examples / dos32 / aptest.asm next >
Encoding:
Assembly Source File  |  2001-12-15  |  1.8 KB  |  79 lines

  1. ;;
  2. ;; aPLib compression library  -  the smaller the better :)
  3. ;;
  4. ;; DOS32 example
  5. ;;
  6. ;; Copyright (c) 1998-2000 by Joergen Ibsen / Jibz
  7. ;; All Rights Reserved
  8. ;;
  9.  
  10. .386p
  11. .model flat
  12.  
  13. locals
  14. jumps
  15.  
  16. .stack 256
  17.  
  18. .data?
  19.  
  20.  dest    db 128      dup (?)
  21.  check   db 128      dup (?)
  22.  workmem db 640*1024 dup (?)
  23.  
  24. .data
  25.  
  26.  src    db 'This is just a simple little test, to see if aPLib works!!!$'
  27.  srclen dd ($-src)
  28.  
  29.  pcktxt db 'Packing...', 0dh, 0ah, '$'
  30.  
  31. .code
  32.  
  33.  extrn _aP_pack            : near
  34.  extrn _aP_depack_asm      : near
  35.  extrn _aP_depack_asm_fast : near
  36.  
  37. aplib_asm_test:
  38.         ; compress src -> dest
  39.         push  offset callback     ; no callback, hence NULL
  40.         push  offset workmem      ; 1mb of workmem
  41.         push  [srclen]            ; length
  42.         push  offset dest         ; destination
  43.         push  offset src          ; source
  44.         call  _aP_pack            ; compress
  45.         add   esp, 5*4            ; adjust stack (function is cdecl)
  46.  
  47.         ; decompress dest -> check
  48.         push  offset check        ; destination
  49.         push  offset dest         ; source
  50.         call  _aP_depack_asm_fast ; decompress
  51.         add   esp, 2*4            ; adjust stack (function is cdecl)
  52.  
  53.         ; print out check to verify
  54.         mov   edx, offset check   ; print result
  55.         mov   ah, 09h
  56.         int   21h
  57.  
  58.         ; exit to dos
  59. c_done:
  60.         mov   ax, 4C00h
  61.         int   21h
  62.  
  63. callback:
  64.         push  ebp
  65.         mov   ebp, esp
  66.         pushad
  67.  
  68.         ; print out 'Packing...' just to show it works
  69.         mov   edx, offset pcktxt
  70.         mov   ah, 09h
  71.         int   21h
  72.  
  73.         popad
  74.         pop   ebp
  75.         mov   eax, 1              ; continue packing
  76.         ret
  77.  
  78. END aplib_asm_test
  79.